//
//  BaseRequestEntity.h
//  BALPractice
//
//  Created by zhuhao on 15/3/5.
//  Copyright (c) 2015年 zhuhao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>
#import "BALRequestServiceManager.h"

typedef enum {
    RequestMethodTypeGet,
    RequestMethodTypePost,
}RequestMethodType;

/**
 *  基础的 请求实体
 *  -- 包含 参数配置
 *  -- 包含 返回参数解析 paser
 */
@interface BALBaseRequestEntity : NSObject

@property(nonatomic,strong)NSString *baseURL;
@property(nonatomic,strong)NSString *urlModulePath;
@property(nonatomic,strong)NSString *urlPath;
@property(nonatomic,strong)NSMutableDictionary *params;
@property(nonatomic,assign)RequestMethodType requestMethod;
@property(nonatomic,assign)NSTimeInterval timeout;

@property(nonatomic,strong)AFHTTPRequestOperation *currentRequestOperation;

/**
 *  构建请求参数，
 *  基类 只添加 公共参数，子类 要重写 该方法
 */
- (void)formart;

- (void)afterFormart;


- (void)addParam:(id<NSObject>)value forKey:(NSString *)key;

/**
 *  根据 服务端 返回的 数据 构造 model
 *
 */
- (id)createDataModelWithResponseData:(id)responseData;

/**
 *  请求网络
 */
- (void)startConnectServer;

@end
